Skip to content

refactor: refactor list stages' warehouse filter for consistency#6163

Merged
krancour merged 1 commit intoakuity:mainfrom
krancour:krancour/refactor-warehouse-filter
Apr 24, 2026
Merged

refactor: refactor list stages' warehouse filter for consistency#6163
krancour merged 1 commit intoakuity:mainfrom
krancour:krancour/refactor-warehouse-filter

Conversation

@krancour
Copy link
Copy Markdown
Member

Follow up to #6153

Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
@krancour krancour requested a review from a team as a code owner April 24, 2026 17:04
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 24, 2026

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 5b208b4
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/69eba289a87e330008e0c23e
😎 Deploy Preview https://deploy-preview-6163.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@krancour krancour changed the title refactor list stages' warehouse filter for consistency refactor: refactor list stages' warehouse filter for consistency Apr 24, 2026
@krancour krancour self-assigned this Apr 24, 2026
@krancour krancour added kind/refactor Non-functional changes to implementation details priority/normal This is the priority for most work area/api-server Affects Kargo's API server labels Apr 24, 2026
@krancour krancour added this to the v1.10.3 milestone Apr 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.69%. Comparing base (91a058b) to head (5b208b4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6163      +/-   ##
==========================================
+ Coverage   57.67%   57.69%   +0.01%     
==========================================
  Files         474      474              
  Lines       40506    40518      +12     
==========================================
+ Hits        23362    23376      +14     
+ Misses      15749    15748       -1     
+ Partials     1395     1394       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

jacobboykin added a commit to jacobboykin/kargo that referenced this pull request Apr 24, 2026
Promotes two helpers that were living in pkg/server to pkg/api/stage.go,
alongside GetStage, ListFreightAvailableToStage, and the rest of the
Stage-domain operations. Both are now exported and unit-tested:

- StripStageForSummary: in-place projection that clears heavy fields
  (freightHistory[1..], promotionTemplate step configs, health.output)
  from a Stage. Previously a package-private helper in
  pkg/server/list_stages_v1alpha1.go.

- ListStageHealthOutputs: given a project and a set of Stage names,
  returns map[name]raw-health-output. Previously inlined (twice — once
  for the ConnectRPC handler and once for the REST handler) in
  pkg/server/get_stage_health_outputs_v1alpha1.go, alongside a
  private uniqueNonEmptyStrings helper that is now folded into the
  exported function.

The server handlers are now thin adapters that validate transport-level
concerns (batch-size cap) and delegate domain work to pkg/api. This
matches the convention akuity#6163 establishes for StageMatchesAnyWarehouse /
ListStagesByWarehouses.

Signed-off-by: Jacob Boykin <boykinmusic@gmail.com>
Signed-off-by: Jacob Boykin <jacob.boykin@akuity.io>
jacobboykin added a commit to jacobboykin/kargo that referenced this pull request Apr 24, 2026
…n/stage-summary-api

Applies Kent's pkg/api Stage-domain consolidation ahead of its merge so
this branch is ready to land cleanly once akuity#6163 is in main.

Kent's PR promotes stageMatchesAnyWarehouse + listStagesByWarehouses
from pkg/server into pkg/api (exported, unit-tested, options-struct
shaped). Our REST listStages handler now calls api.ListStagesByWarehouses
directly. Our ConnectRPC ListStages handler does its list inline so it
can surface list.ResourceVersion for the list-then-watch response field;
filtering still goes through api.StageMatchesAnyWarehouse to keep the
matching logic in one place.

Signed-off-by: Jacob Boykin <boykinmusic@gmail.com>
Signed-off-by: Jacob Boykin <jacob.boykin@akuity.io>
Copy link
Copy Markdown
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for not noticing this pattern in my PR!

@krancour
Copy link
Copy Markdown
Member Author

It was easy to miss, no worries.

@krancour krancour added this pull request to the merge queue Apr 24, 2026
Merged via the queue into akuity:main with commit c737ce5 Apr 24, 2026
24 of 25 checks passed
@krancour krancour deleted the krancour/refactor-warehouse-filter branch April 24, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api-server Affects Kargo's API server kind/refactor Non-functional changes to implementation details priority/normal This is the priority for most work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants